package myky.com.doctorapp.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import myky.com.doctorapp.R
import myky.com.doctorapp.entity.DepatmentAndAreaEntity

class DoctorListCityAdapter(mAreaCityList: MutableList<DepatmentAndAreaEntity.DataEntity.AreaEntity.CityEntity>) : BaseQuickAdapter<DepatmentAndAreaEntity.DataEntity.AreaEntity.CityEntity, BaseViewHolder>(R.layout.item_doc_list_deapartmen, mAreaCityList) {


    var selectedCity: String = ""


    fun setCity(city: String) {
        this.selectedCity = city
    }

    override fun convert(helper: BaseViewHolder, item: DepatmentAndAreaEntity.DataEntity.AreaEntity.CityEntity) {


        val cityName = item.cityName


        helper.setText(R.id.doc_city_textvView, cityName)


        if (cityName.equals(selectedCity)) {
            helper.setTextColor(R.id.doc_city_textvView, mContext.resources.getColor(R.color.theme_app))
        } else {
            helper.setTextColor(R.id.doc_city_textvView, mContext.resources.getColor(R.color.gray_222222))
        }

        helper.addOnClickListener(R.id.doc_city_lisrview_item)

    }
}